'use strict';

var express = require('express');
var controller = require('./user.controller');
var auth = require('../../auth/auth.service');

var router = express.Router();

//用户注册
router.post('/getCode', controller.getPhoneCode);
router.post('/confirmCode', controller.confirmCode);
router.post('/addUser', controller.addUser);
//用户管理
router.get('/getUserList', auth.hasRole('admin'), controller.getUserList);
router.delete('/:id', auth.hasRole('admin'), controller.destroy);
router.put('/:id/updateUser', auth.hasRole('admin'), controller.updateUser);
// 粉丝相关
// 添加关注
router.post('/addStar',auth.isAuthenticated(),controller.addStar);
// 获取粉丝列表
router.get('/getFansList',auth.isAuthenticated(),controller.getFansList);
// 获取关注列表
router.get('/getStarsList/:id',controller.getStarsList);
//用户更新信息
router.get('/getUserProvider', auth.isAuthenticated(), controller.getUserProvider);
// router.get('/getCaptcha', controller.getCaptcha);
router.get('/getUserInfo', controller.getUserInfo);
router.get('/me', auth.isAuthenticated(), controller.getMe);
router.get('/snsLogins', controller.getSnsLogins)
module.exports = router;
